package com.ag.lzw.action;

import java.util.List;
import java.util.Map;


import com.ag.common.BaseAction;
import com.ag.common.PageUtil;
import com.ag.hmk.service.impl.HmkUiltServImpl;



public class FindTaskOverReqAction extends BaseAction {

	private static final long serialVersionUID = -4872344772248312047L;

	
	private HmkUiltServImpl hmkUiltServImpl;
	
	
	private PageUtil TaskOverReqList;
	private Map<String, String> queryOption; 
	
	/**
	 *  分页查询任务办结
	 * @return
	 * @throws Exception
	 */
	public String findTaskOverReq()throws Exception{
		PageUtil pageUitl = new PageUtil();
		int firstRow = 0;
		int maxRow = 10;
		int page = 0;
		int total = 0;
		String tid = null;
		List list = null;
		if (queryOption.containsKey("tid") && !queryOption.get("tid").isEmpty()) {
			tid = queryOption.get("tid");
			if (queryOption.containsKey("page")
					&& !queryOption.get("page").isEmpty()) {
				//page = Integer.parseInt(queryOption.get("page"));
				firstRow = maxRow * (page - 1);
				String hql = "from TbOverRequest tor left join fetch tor.tbTask tt left join fetch " +
				" tt.tbTaskStatus  where tt.TId ='"+tid+"'"; //"10000000105"
				
				System.out.println("=="+hql);
				
				list = hmkUiltServImpl.query(hql, 0, 10);
				if (list!=null) {
					total = list.size();
					System.out.println("=========vvvvvv:"+total);
				} 
				
			}
		} 
		pageUitl.setMaxRow(maxRow);
		pageUitl.setPage(page);
		pageUitl.setTotal(total);
		pageUitl.setList(list);
		
		this.setTaskOverReqList(pageUitl);
		System.out.println("get work ok");
		return "findOverReqOK";
	}

	public PageUtil getTaskOverReqList() {
		return TaskOverReqList;
	}

	public void setTaskOverReqList(PageUtil taskOverReqList) {
		TaskOverReqList = taskOverReqList;
	}


	public void setQueryOption(Map<String, String> queryOption) {
		this.queryOption = queryOption;
	}

	public void setHmkUiltServImpl(HmkUiltServImpl hmkUiltServImpl) {
		this.hmkUiltServImpl = hmkUiltServImpl;
	}
}
